const app = getApp();
console.log(app);
const name = app.globalData.name;
const age = app.globalData.age;
console.log(name);
console.log(age);
Page({
  data:{
    name:'codewhy',
    age:'18',
    students:[{'id':110,name:'kobe',age:'20'},
              { 'id':110, name:'kobe', age:'20'},
              {'id':110, name:'kobe',age:'20'},],
    counter:0,          
  },
  click(){
    this.data.counter++;
    console.log(this.data.counter);
    this.setData({
      counter:this.data.counter,
    })
  },
  jian(){
    this.data.counter--;
    console.log(this.data.counter);
    this.setData({
      counter:this.data.counter,
    })
  },
  //命令式编程：原生DOM  声明式编程 :告诉程序要做什么
   onLoad(){
     console.log('我是home')
   },
   handleGetUserInfo(event){
     console.log(event);
   },
   onReady(){

   },
   onShow(){

   },
   onHide(){

   },
   onUnload(){

   },
   onPullDownRefresh(){
     console.log('刷新');
   },
   //监听页面的滚动
   onPageScroll(obj){
     console.log(obj);
   },
   onReachBottom(){
     console.log('滚动到底部');
   }
})